home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 February / EnterCD 02_2004.iso / Gry / Arcade! Classic Arcade Pack 2.0 / Arcade.EXE / $PROGRAMFILES / Arcade! Classic Arcade Pack / pacman.swf / scripts / frame_4 / DoAction.as
Encoding:
Text File  |  2003-12-05  |  4.9 KB  |  233 lines

  1. function initVars()
  2. {
  3.    pacDir = 3;
  4.    pacPos = 0;
  5.    pacX = 14;
  6.    pacY = 23;
  7.    nextX = pacX - 1;
  8.    nextY = pacY;
  9.    nextPacDir = 3;
  10.    ghKill = 100;
  11.    ghBlue = 0;
  12.    numEyes = 0;
  13.    Pacman.gotoAndStop(1);
  14.    pacStep = 4;
  15.    pacPosMax = 2;
  16.    pauseCount = 0;
  17.    with(Pacman)
  18.    {
  19.       _x = OFFX + 12 * pacX;
  20.       _y = OFFY + 12 * pacY;
  21.       _rotation = 0;
  22.    }
  23.    tellTarget(Ghost[1])
  24.    {
  25.       ghPos = 1;
  26.       ghDir = 3;
  27.       ghX = 13;
  28.       ghY = 11;
  29.       ghNX = ghX - 1;
  30.       _Y = _root.OFFY + 132;
  31.       cOrig = 14483456;
  32.    }
  33.    tellTarget(Ghost[2])
  34.    {
  35.       ghDir = 0;
  36.       ghX = 13;
  37.       cOrig = 16751001;
  38.    }
  39.    tellTarget(Ghost[3])
  40.    {
  41.       ghDir = 2;
  42.       ghX = 11;
  43.       cOrig = 6750207;
  44.    }
  45.    tellTarget(Ghost[4])
  46.    {
  47.       ghDir = 2;
  48.       ghX = 15;
  49.       cOrig = 16750848;
  50.    }
  51.    g = 1;
  52.    while(g < 5)
  53.    {
  54.       tellTarget(Ghost[g])
  55.       {
  56.          if(this.g > 1)
  57.          {
  58.             ghPos = 0;
  59.             ghY = 14;
  60.             ghNX = ghX;
  61.             _Y = _root.OFFY + 174;
  62.          }
  63.          _X = _root.OFFX + 12 * ghX + 6;
  64.          gotoAndStop(1);
  65.          Eyes.gotoAndStop(1);
  66.          gNum = 0;
  67.          ghNY = ghY;
  68.          ghStep = 4;
  69.          ghPosMax = 2;
  70.          ghFast = true;
  71.          Shape._visible = true;
  72.          Shape.Hit._visible = true;
  73.          c = new Color(Shape);
  74.          c.setRGB(cOrig);
  75.       }
  76.       g++;
  77.    }
  78. }
  79. function setPacMove(d)
  80. {
  81.    if(d == 0)
  82.    {
  83.       nextX = pacX;
  84.       nextY = pacY - 1;
  85.       Pacman._rotation = 90;
  86.    }
  87.    else if(d == 1)
  88.    {
  89.       nextX = pacX + 1;
  90.       nextY = pacY;
  91.       Pacman._rotation = 180;
  92.    }
  93.    else if(d == 2)
  94.    {
  95.       nextX = pacX;
  96.       nextY = pacY + 1;
  97.       Pacman._rotation = -90;
  98.    }
  99.    else if(d == 3)
  100.    {
  101.       nextX = pacX - 1;
  102.       nextY = pacY;
  103.       Pacman._rotation = 0;
  104.    }
  105. }
  106. function setGhMove(d, g)
  107. {
  108.    with(Ghost[g])
  109.    {
  110.       if(d == 0)
  111.       {
  112.          ghNX = ghX;
  113.          ghNY = ghY - 1;
  114.       }
  115.       else if(d == 1)
  116.       {
  117.          ghNX = ghX + 1;
  118.          ghNY = ghY;
  119.       }
  120.       else if(d == 2)
  121.       {
  122.          ghNX = ghX;
  123.          ghNY = ghY + 1;
  124.       }
  125.       else if(d == 3)
  126.       {
  127.          ghNX = ghX - 1;
  128.          ghNY = ghY;
  129.       }
  130.    }
  131. }
  132. function startBGSnd()
  133. {
  134.    tellTarget("BGSnd")
  135.    {
  136.       if(_root.ghBlue > 2)
  137.       {
  138.          if(_root.numEyes)
  139.          {
  140.             EyesGh.start(0,100);
  141.             BlueGh.stop();
  142.          }
  143.          else
  144.          {
  145.             EyesGh.stop();
  146.             BlueGh.start(0,100);
  147.          }
  148.       }
  149.       else
  150.       {
  151.          BlueGh.stop();
  152.          EyesGh.stop();
  153.          _root["Back" + _root.bgNum].start(0,1000);
  154.       }
  155.    }
  156. }
  157. OFFX = 18;
  158. OFFY = 18;
  159. score = 0;
  160. lastScore = 0;
  161. lives = 3;
  162. level = 0;
  163. fruitNum = 1;
  164. notMute = true;
  165. newLev = true;
  166. newGame = true;
  167. newLife = false;
  168. quttting = false;
  169. quit = false;
  170. Snd.ChSnd = true;
  171. Pacman.Hit._visible = false;
  172. ghPause = 40;
  173. ghBVal = 162;
  174. ghMove = new Array(4);
  175. ghChoice = new Array(4);
  176. ghBest = new Array(4);
  177. var g = 1;
  178. while(g < 5)
  179. {
  180.    Ghost.attachMovie("Ghost",g,g);
  181.    Ghost.attachMovie("GhKill","K" + g,g + 4);
  182.    Ghost["K" + g].kval = "";
  183.    g++;
  184. }
  185. var i = 1;
  186. while(i < 5)
  187. {
  188.    _root["Life" + i].gotoAndStop(1);
  189.    if(i >= lives)
  190.    {
  191.       _root["Life" + i]._visible = false;
  192.    }
  193.    i++;
  194. }
  195. m = "#############################............##............##.####.#####.##.#####.####.##O####.#####.##.#####.####O##.####.#####.##.#####.####.##..........................##.####.##.########.##.####.##.####.##.########.##.####.##......##....##....##......#######.##### ## #####.############.##### ## #####.############.##          ##.############.## ######## ##.############.## # # # ## ##.######L     .   # # # ##   .     R######.## ### #### ##.############.## ######## ##.############.##          ##.############.## ######## ##.############.## ######## ##.#######............##............##.####.#####.##.#####.####.##.####.#####.##.#####.####.##O..##.......  .......##..O####.##.##.########.##.##.######.##.##.########.##.##.####......##....##....##......##.##########.##.##########.##.##########.##.##########.##..........................#############################";
  196. var i = -1;
  197. while(i < 29)
  198. {
  199.    Maze.attachMovie("Empty",i,i + 1);
  200.    i++;
  201. }
  202. pos = 0;
  203. var j = 0;
  204. while(j < 31)
  205. {
  206.    var i = 0;
  207.    while(i < 28)
  208.    {
  209.       Maze[i][j] = m.charAt(pos++);
  210.       pill = false;
  211.       if(Maze[i][j] == ".")
  212.       {
  213.          pill = true;
  214.          Maze[i].attachMovie("Pill","P" + j,pos);
  215.       }
  216.       if(Maze[i][j] == "O")
  217.       {
  218.          pill = true;
  219.          Maze[i].attachMovie("Power","P" + j,pos);
  220.       }
  221.       if(pill)
  222.       {
  223.          with(Maze[i]["P" + j])
  224.          {
  225.             _x = OFFX + 12 * i;
  226.             _y = OFFY + 12 * j;
  227.          }
  228.       }
  229.       i++;
  230.    }
  231.    j++;
  232. }
  233.